using System;
using System.Xml.Serialization;

namespace Code5Systems.FormMaster.Business
{

	#region FormInfo

	[Serializable(), XmlRoot("FormInfo")]public class FormInfo
	{
		
#region Public Enumerations
		
		public enum EmailActionNone
		{
			None = 1,
			UseAdmin = 2,
			UserDefined = 3,
			UseForm = 4
		}
		
		public enum EmailAction
		{
			UseAdmin = 1,
			UserDefined = 2,
			UseForm = 3
		}
		
#endregion
		
#region Private Members
		
		private string _replyTo = string.Empty;
		
#endregion
		
#region Constructors
		
		public FormInfo()
		{
			FormName = "New Form";
			EmailFromAction = (byte) 1;
			FromAddress = string.Empty;
			EmailSendFromControl = "None Defined";
			EmailSendAction = (byte) 1;
			EmailSendTo = string.Empty;
			EmailSendToControl = "None Defined";
			SaveData = true;
			TableColumns = (byte) 1;
			TableRows = (byte) 1;
			TableClass = string.Empty;
			LabelPosition = (byte) 1;
			TableClass = string.Empty;
			FormDefinition = string.Empty;
			EmailCcMeControl = string.Empty;
			CaptchaCharacters = string.Empty;
			UseExtTable = false;
			ExtIdentityColumn = string.Empty;
			ExtTableConnStr = string.Empty;
			ExtTableName = string.Empty;
			ReplyToAction = (byte) 1;
			ReplyTo = string.Empty;
			ReplyToControl = string.Empty;
			ExtTableForEachPage = false;
			ValidationGroup = String.Empty;
		}
		
#endregion
		
#region Public Properties
		
		[XmlElement("FormID")]
		public int FormID {get; set;}
		
		[XmlElement("PortalID")]
		public int PortalID {get; set;}
		
		[XmlElement("ModuleID")]
		public int ModuleID {get; set;}
		
		[XmlElement("FormName")]
		public string FormName {get; set;}
		
		[XmlElement("EmailFromAction")]
		public byte EmailFromAction {get; set;}
		
		[XmlElement("FromAddress")]
		public string FromAddress {get; set;}
		
		[XmlElement("EmailSendFromControl")]
		public string EmailSendFromControl {get; set;}
		
		[XmlElement("BccAddress")]
		public string BccAddress {get; set;}
		
		[XmlElement("EmailSendAction")]
		public byte EmailSendAction {get; set;}
		
		[XmlElement("EmailSendTo")]
		public string EmailSendTo {get; set;}
		
		[XmlElement("EmailSendToControl")]
		public string EmailSendToControl {get; set;}
		
		[XmlElement("SaveData")]
		public bool SaveData {get; set;}
		
		[XmlElement("TableColumns")]
		public byte TableColumns {get; set;}
		
		[XmlElement("TableRows")]
		public byte TableRows {get; set;}
		
		[XmlElement("TableClass")]
		public string TableClass {get; set;}
		
		[XmlElement("LabelPosition")]
		public byte LabelPosition {get; set;}
		
		[XmlElement("FormDefinition")]
		public string FormDefinition {get; set;}
		
		[XmlElement("CreatedByID")]
		public int CreatedByID {get; set;}
		
		[XmlElement("CreatedDate")]
		public DateTime CreatedDate {get; set;}
		
		[XmlElement("LastModifiedByID")]
		public int LastModifiedByID {get; set;}
		
		[XmlElement("LastModifiedDate")]
		public DateTime LastModifiedDate {get; set;}
		
		[XmlElement("ShowCcMe")]
		public bool ShowCcMe {get; set;}
		
		[XmlElement("EmailCcMeControl")]
		public string EmailCcMeControl {get; set;}
		
		[XmlElement("ConnectionString")]
		public string ConnectionString {get; set;}
		
		[XmlElement("FormQuery")]
		public string FormQuery {get; set;}
		
		
		

		[XmlElement("CaptchaCharacters")]
		public string CaptchaCharacters { get; set; }

		[XmlElement("UseCaptcha")]
		public bool UseCaptcha { get; set; }


		[XmlElement("UseExtTable")]
		public bool UseExtTable {get; set;}
		
		[XmlElement("ExtIdentityColumn")]
		public string ExtIdentityColumn {get; set;}
		
		[XmlElement("ExtTableConnStr")]
		public string ExtTableConnStr {get; set;}
		
		[XmlElement("ExtTableName")]
		public string ExtTableName {get; set;}
		
		[XmlElement("ReplyToAction")]
		public byte ReplyToAction {get; set;}
		
		[XmlElement("ReplyTo")]
		public string ReplyTo
		{
			get
			{
				if (string.IsNullOrEmpty(_replyTo))
				{
					return FromAddress;
				}
				else
				{
					return _replyTo;
				}
			}
			set
			{
				_replyTo = value;
			}
		}
		
		[XmlElement("ReplyToControl")]
		public string ReplyToControl {get; set;}
		
		[XmlElement("CurrentPage")]
		public FormPageInfo CurrentPage {get; set;}
		
		[XmlElement("ExtTableForEachPage")]
		public bool ExtTableForEachPage {get; set;}

		[XmlElement("ValidationGroup")]
		public string ValidationGroup { get; set; }
		
#endregion
		
	}
	
#endregion
	
}
